<template>
  <!--登录-->
  <el-form label-width="100px" class="container">
    <el-form-item label="邮箱:">
      <el-input
        type="email"
        v-model="email"
        placeholder="请输入邮箱"
      ></el-input>
    </el-form-item>
    <el-form-item>
      <el-button
        @click="handleForgotPassword()"
        type="primary"
        class="submit-btn"
        >找回密码
      </el-button>
    </el-form-item>
  </el-form>
</template>
<script lang="ts">
import { defineComponent, ref, getCurrentInstance } from "vue";

export default defineComponent({
  name: "Forgotpassword",
  setup() {
    //@ts-ignore
    const { ctx } = getCurrentInstance();
    const email = ref<string>("");
    const handleForgotPassword = async () => {
      // console.log(email.value);
      if (email.value) {
        const res = await ctx.$axios.post("http://localhost:3006/posts", {
          email: email.value,
        });
        console.log(res.data);
      }
    };
    return { handleForgotPassword, email };
  },
});
</script>
<style scoped>
.container {
  width: 50%;
  margin: 200px auto;
  border: 1px solid rgba(255, 255, 255, 0.479);
}
.submit-btn {
  width: 100%;
}
</style>